﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Netfraction.Network.Protocol.BASE.Factory
{
    public enum CTMParameterOptions : int
    {
        SessionId = 0,
        TargetId = 1,
        Protocol = 2,
        Port = 3,
        Token = 4
    }

    public class FactoryCTM : ProtocolMessageFactory
    {
        public override ProtocolMessage Create(ProtocolMessage.MessageTypeEnum messageType, Dictionary<int, object> parameters)
        {
            ProtocolMessage proto = new ProtocolMessage(messageType, ProtocolFeatureBASE.FeatureActions.ActionCTM);

            proto.SessionId = parameters[(int)CTMParameterOptions.SessionId].ToString();

            proto.TargetSessionId = parameters[(int)CTMParameterOptions.TargetId].ToString();

            proto.Parameters.Add(new ProtocolParameter(parameters[(int)CTMParameterOptions.Protocol].ToString()));

            proto.Parameters.Add(new ProtocolParameter(parameters[(int)CTMParameterOptions.Port].ToString()));

            proto.Parameters.Add(new ProtocolParameter(parameters[(int)CTMParameterOptions.Token].ToString()));

            return proto;
        }
    }
}
